import React, { Component, useState, useRef } from "react";
import classNames from "classnames";
import "./index.css";
function Child(props) {
  //props可以传递任何数据
  //数字、字符串、布尔值、数组、对象、函数、JSX
  console.log(props, "");

  return (
    <>
      <div>
        <h3>这是子组件</h3>
      </div>
      <p>接收到的数据：{props.name}</p>
      <div>{props.par}</div>
      <div> {props.children}</div>
    </>
  );
}
export default function Parent() {
  let name = "seihai";
  let pargrash = () => {
    return (
      <>
        <div>
          Lorem ipsum dolor sit amet consectetur adipisicing elit. Eos excepturi
          animi corporis nulla vitae commodi earum quia fuga voluptate, delectus
          dolorem, ea hic iusto quidem. Eligendi magnam eius dicta obcaecati?
        </div>
      </>
    );
  };
  return (
    <>
      <h1>props传递参数</h1>
      <Child name={name} par={pargrash()}>
        <div style={{color:'red'}}> 特殊的props,通过在子组件内部写标签，子组件通过props.children接收</div>
      </Child>
    </>
  );
}
